﻿@{
    Layout = "~/Views/Shared/_Index.cshtml";

}
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.net/Public/js/easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.net/Public/js/easyui/themes/icon.css" />

<link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-ribbon/ribbon.css" />
<link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-ribbon/ribbon-icon.css" />

<script type="text/javascript" src="http://www.jeasyui.net/Public/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="~/Content/jquery-easyui-ribbon/jquery.ribbon.js"></script>
<link href="~/Content/jquery-easyui-ribbon/MedicalRecordEdit.css" rel="stylesheet" />
<form method="post">

    <span id="toolDiv">
        @Html.Partial("_DCSW.ToolList")
        <input type="submit" name="saveDocument" id="saveXml" value="保存文档" class="edtBtn" style="background-image: url(/Content/img/tupian/-_保存.ico);background-repeat: no-repeat;background-size: 30%;padding-left: 30px;height: 30px;" />
        <div class="ribbon-toolbar">
            <a href="#" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" title="插入年龄输入域" data-options=" iconCls:'icon-age',plain:true" val="InsertAgeField" onclick="MyExecuteCommand(this);" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">插入年龄输入域</span><span class="l-btn-icon icon-age">&nbsp;</span></span></a><br>
            <a href="#" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" title="插入性别输入域" data-options=" iconCls:'icon-sex',plain:true" val="InsertSexField" onclick="MyExecuteCommand(this);" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">插入性别输入域</span><span class="l-btn-icon icon-sex">&nbsp;</span></span></a><br>
            <a href="#" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" title="插入日期输入域" data-options=" iconCls:'icon-date',plain:true" val="InsertDateTime" onclick="MyExecuteCommand(this);" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">插入日期输入域</span><span class="l-btn-icon icon-date">&nbsp;</span></span></a><br>
        </div>

        <div class="ribbon-toolbar">
            <a href="#" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" title="插入按钮" data-options=" iconCls:'icon-button',plain:true" val="InsertInputButton" onclick="MyExecuteCommand(this);" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">插入按钮</span><span class="l-btn-icon icon-button">&nbsp;</span></span></a><br>
            <a href="#" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" title="插入复选框" data-options=" iconCls:'icon-fxk',plain:true" val="InsertInputCheckbox" onclick="MyExecuteCommand(this);" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">插入复选框</span><span class="l-btn-icon icon-fxk">&nbsp;</span></span></a><br>
            <a href="#" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" title="插入单选框" data-options=" iconCls:'icon-dxk',plain:true" val="InsertInputRadio" onclick="MyExecuteCommand(this);" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">插入单选框</span><span class="l-btn-icon icon-dxk">&nbsp;</span></span></a><br>
        </div>
    </span>
    <a id="toolShow" class="btn btn-primary" style="float:right;"><i></i>工具栏</a>
    <div style="clear:both;">
    </div>

    @Html.Raw(ViewBag.WriterControlHtml)

</form>

<script language=javascript>

            function MyExecuteCommand(lst) {
                if (lst.getAttribute("val") == "InsertAgeField") {
                    // 插入年龄域
                    MyInsertNameInputField();
                }
                else if (lst.getAttribute("val") == "InsertSexField") {
                    // 插入性别域
                    MyInsertSexInputField();
                }
                else if (lst.getAttribute("val") == "InsertDateTime") {
                    // 插入日期域
                    MyInsertDateInputField();
                }
                else if (lst.getAttribute("val") == "InsertInputCheckbox") {
                    // 插入复选框
                    MyInsertCheckBoxInputField();
                }
                else if (lst.getAttribute("val") == "InsertInputRadio") {
                    // 插入单选框
                    MyInsertRadioInputField();
                }
                else if (lst.getAttribute("val") == "InsertInputButton") {
                    // 插入按钮
                    MyInsertButtonInputField();
                }

                else {
                    var ctl = document.getElementById("myWriterControl");
                    var nam = lst.getAttribute("val");
                    var sho = lst.getAttribute("showui") == "true";
                    var par = lst.getAttribute("parameter");
                    ctl.DCExecuteCommand(nam, sho, par);
                }

            }

            // 插入年龄输入域
            function MyInsertNameInputField() {
      

                var options = {
                    "ContentReadonly": false,
                    "ToolTip": "请输入年龄",
                    "BackgroundText": "年龄",
                    //"labelText":"年龄:",
                    "Text": "30",
                    "InnerValue": "30",
                    "ValidateStyle": "Required:True;ValueType:Numeric;CheckMaxValue:True;MaxValue:150;CheckMinValue:True;MinValue:0",
                    "EnableValueValidate": true,
                    "Name": "年龄",
                    "ID": "txtAge",
                    "StartBorderText": "[",
                    "EndBorderText": "]",
                    "UnitText": "岁"
                };
                document.getElementById('myWriterControl').DCExecuteCommand('Spechars', true, "年龄:");
                document.getElementById('myWriterControl').DCExecuteCommand("InsertInputField", true, options);
            }
            // 插入性别输入域
            function MyInsertSexInputField() {
                var ctl = document.getElementById("myWriterControl");
                var options = {
                    "ContentReadonly": false,
                    "ToolTip": "请选择性别",
                    "BackgroundText": "性别",
                    "EnableValueValidate": true,
                    "Name": "性别",
                    "ID": "txtSex",
                    "StartBorderText": "[",
                    "EndBorderText": "]",
                    "ListItems": [
                        { "Text": "男", "Value": "1" },
                        { "Text": "女", "Value": "0" },
                        { "Text": "其他", "Value": "2" }
                    ],
                    "InnerEditStyle": "DropdownList",
                    "EditorActiveMode": "MouseClick"
                };
                var field = ctl.DCExecuteCommand("InsertInputField", true, options);
                if (field != null) {
                    ctl.FocusAdjacent("afterEnd", field); //这里的第一个参数可以是beforeBegin,afterBegin,beforeEnd,afterEnd
                }
            }

            // 插入日期输入域
            function MyInsertDateInputField() {
                var ctl = document.getElementById("myWriterControl");
                var options = {
                    "ContentReadonly": false,
                    "ToolTip": "请输入日期",
                    "BackgroundText": "日期",
                    "Text": "2015-01-09 09:39",
                    "InnerEditStyle": "DateTime",
                    "EditorActiveMode": "MouseClick",
                    "EnableValueValidate": true,
                    "Name": "日期",
                    "ID": "txtDate"
                };
                ctl.DCExecuteCommand("InsertInputField", true, options);
            }

            // 插入按钮
            function MyInsertButtonInputField() {
                var ctl = document.getElementById("myWriterControl");
                var options = {
                    "ContentReadonly": false,
                    "SpecifyWidth": 10,
                    "ToolTip": "这是一个按钮",
                    "inputtype": "button",
                    "value": "按钮",
                    "InnerEditStyle": "input",
                    "EditorActiveMode": "MouseClick",
                    "EnableValueValidate": true,
                    "ID": "123"
                };
                ctl.DCExecuteCommand("InsertInputField", true, options);
            }

            // 插入复选框
            function MyInsertCheckBoxInputField() {
                var ctl = document.getElementById("myWriterControl");
                var options = {
                    "SpecifyWidth": 3,
                    "ToolTip": "这是一个复选框",
                    "inputtype": "checkbox",
                    "InnerEditStyle": "input",
                    "EditorActiveMode": "MouseClick",
                    "EnableValueValidate": true,
                    "name": "fxk2",
                    "ID": "checkbox"
                };
                var options1 = {
                    "ContentReadonly": false,
                    "ToolTip": "复选框文本",
                    "labeltype": "label",
                    "for": "checkbox",
                    "value": "选项1"
                };
                ctl.DCExecuteCommand("InsertInputField", true, options1);
                ctl.DCExecuteCommand("InsertInputField", true, options);
            }


            // 插入单选框
            function MyInsertRadioInputField() {
                var ctl = document.getElementById("myWriterControl");
                var options = {
                    "SpecifyWidth": 3,
                    "ToolTip": "这是一个单选框",
                    "inputtype": "radio",
                    "InnerEditStyle": "input",
                    "EditorActiveMode": "MouseClick",
                    "EnableValueValidate": true,
                    "name": "fxk1",
                    "ID": "iradio"
                };
                var options1 = {
                    "ContentReadonly": false,
                    "ToolTip": "复选框文本",
                    "labeltype": "label",
                    "for": "iradio",
                    "value": "选项1"
                };
                ctl.DCExecuteCommand("InsertInputField", true, options1);
                ctl.DCExecuteCommand("InsertInputField", true, options);
            }
   
            function DragScroll(v) {
                var ctl = document.getElementById("myWriterControl");
                ctl.setMouseDragScrollMode(v);
            }



</script>
@Html.Partial("_DCSW.JS")
<div id="treeDiv">
    @Html.Action("YSList", "Blys")
</div>